<template>
  <div class="rightMiddle">
    <div class="headerMaintitle">
      <img class="topPic" src="../assets/rightBottom3.png" alt="" />
      <div class="headerText">标题1</div>
    </div>
    <div class="jiang">
      <img src="../assets/top3.png" alt="" />
    </div>
    <div class="top1 jiangitem">
      <span class="title"> 丰润镇1号水源井(m³) </span>
      <span class="num1"> 3524 </span>
    </div>
    <div class="top2 jiangitem">
      <span class="title"> 丰润镇2号水源井(m³) </span>
      <span class="num1"> 2344 </span>
    </div>
    <div class="top3 jiangitem">
      <span class="title"> 紫草坞2号水源井(m³) </span>
      <span class="num1"> 3545 </span>
    </div>
    <div class="companys">
      <template v-for="(item, index) in companys">
        <div
          v-if="index > 2"
          :key="item.name"
          style="display: flex; align-items: center"
        >
          <div style="display: flex; align-items: center">
            <div class="top">
              <div class="area"></div>
              <div class="text">TOP</div>
            </div>
            <div class="num">
              <div class="area"></div>
              <div class="text">{{ index + 1 }}</div>
            </div>
          </div>
          <div class="item-text">{{ item.name }}</div>
          <div class="item">
            <div
              class="item-progress"
              :style="{
                '--percent': `${item.percent || 0}`,
                '--left': 'calc(1% * var(--percent) - 100%)',
                '--trans': 'calc(-50% - var(--left))',
              }"
            >
              <!-- 进度条背景 -->
              <div class="range-slider">
                <!-- 进度条 -->
                <div class="range"></div>
              </div>
              <img :src="require('../assets/point.png')" class="point" />
            </div>
            <div class="item-percent">{{ item.percent + "%" }}</div>
          </div>
        </div>
      </template>
    </div>
  </div>
</template>
<script>
export default {
  name: "RightMiddle",
  props: {},
  components: {},
  data() {
    return {
      cList: [],
      list: [],
      index: 0,
      timer: null,
      isEmpty: false,
      companys: [
        { name: "COD正常率", percent: 97 },
        { name: "氨氮正常率", percent: 91 },
        { name: "总磷正常率", percent: 82 },
        { name: "总氮正常率", percent: 70 },
        { name: "ph正常率", percent: 80 },
        { name: "11112312", percent: 80 },
      ],
    };
  },
  computed: {},
  watch: {},
  methods: {},
  beforeCreate() {},
  created() {},
  beforeMount() {},
  mounted() {},
  updated() {},

  activated() {},
  deactivated() {},
  beforeDestroy() {},
  destroyed() {},
};
</script>
<style lang="less" scoped>
.rightMiddle {
  margin-top: 20px;
  position: relative;
}
.jiang {
  img {
    width: 90%;
    margin-top: 100px;
    margin-bottom: 40px;
  }
}
.jiangitem {
  display: flex;
  flex-direction: column;
  align-items: center;
  .title {
    font-family: PingFangSC, PingFang SC;
    font-weight: 500;
    font-size: 20px;
    color: #ffffff;
    line-height: 32px;
  }
  .num1 {
    font-family: Alibaba-PuHuiTi, Alibaba-PuHuiTi;
    font-weight: normal;
    font-size: 38px;
    color: #27c0fd;
    line-height: 53px;
  }
  &.top1 {
    position: absolute;
    top: 93px;
    left: 61px;
  }
  &.top2 {
    position: absolute;
    top: 62px;
    left: 267px;
  }
  &.top3 {
    position: absolute;
    top: 111px;
    right: 73px;
  }
}
.top {
  width: 64px;
  height: 24px;
  position: relative;
  .area {
    background: linear-gradient(
      270deg,
      rgba(220, 228, 232, 0.2) 0%,
      rgba(113, 144, 191, 0.2) 100%
    );
    transform: skewX(-20deg);
    width: 100%;
    height: 100%;
  }
  .text {
    font-family: YouSheBiaoTiHei;
    font-size: 24px;
    color: #ffffff;
    line-height: 24px;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding-left: 6px;
    text-align: left;
  }
}
.num {
  width: 28px;
  height: 24px;
  position: relative;
  margin-right: 20px;
  .area {
    background: linear-gradient(
      270deg,
      rgba(55, 112, 139, 1) 0%,
      rgba(113, 144, 191, 1) 100%
    );
    transform: skewX(-20deg);
    width: 100%;
    height: 100%;
  }
  .text {
    font-family: YouSheBiaoTiHei;
    font-size: 24px;
    color: #ffffff;
    line-height: 24px;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    position: absolute;
    text-align: center;
  }
}
.companys {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  padding-left: 20px;
  box-sizing: border-box;
  > div {
    width: 100%;
    margin: 10px 0;
  }
  .item-text {
    color: #ffffff;
    font-size: 20px;
    font-weight: 400;
    text-align: left;
    margin-right: 20px;
    width: 120px;
  }
  .item {
    z-index: 99;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #ffffff;
    font-size: 14px;
    font-weight: 400;
    white-space: nowrap;
    margin: 6px 0;
    .item-progress {
      width: 80%;
      height: 27px;
      display: flex;
      align-items: center;
      .range-slider {
        height: 6px;
        width: 315px;
        font-size: 0;
        border-radius: 3px;
        background-color: #39455a;
        display: flex;
        align-items: center;
      }
      .range {
        width: calc(1% * var(--percent));
        height: 6px;
        border-radius: 3px;
        background: linear-gradient(
          to right,
          rgba(11, 41, 111, 1),
          rgba(20, 174, 255, 1)
        );
        animation: progress 1.5s linear;
      }
      .point {
        animation: progressImg 1.5s linear;
        position: relative;
        left: var(--left);
        width: 32px;
        height: 32px;
        transform: translateX(var(--trans));
      }
    }
    .item-percent {
      width: 20%;
      text-align: right;
      font-size: 22px;
      font-weight: 600;
      color: #39d2ff;
    }
  }
}
</style>
